package com.wgq.TestAnnotation;

import java.lang.reflect.Field;

public class AnnotationReflex {
    public static void main(String[] args) {
        try {
            Class clazz = Class.forName("com.wgq.TestAnnotation.Student");
            AnnotationStudent ann= (AnnotationStudent)clazz.getAnnotation(AnnotationStudent.class);
            System.out.println(ann.value());

            try {
                Field f = clazz.getDeclaredField("id");
                AnnotationStudentFild annf=  f.getAnnotation(AnnotationStudentFild.class);
                System.out.println(annf.columnName()+"---"+annf.Type()+"---"+annf.length());
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
